package HomeWork.store.entry;

import HomeWork.store.inter.Aliyun;
import HomeWork.store.inter.QINiuYun;
import HomeWork.store.inter.Send;

import java.util.Scanner;

public class Entry {
    private static final Scanner sc = new Scanner(System.in) ;

    public static void main(String[] args) {

        // 输出存储方式供用户进行选择
        System.out.println("请选择你的存储方式：1、七牛云存储  2、阿里云oss存储");
        System.out.print("请输入您的选择：");
        String storeType = sc.nextLine();
        // 补全代码
        switch (storeType) {
            case "1" -> sendFile(new QINiuYun());
            case "2" -> sendFile(new Aliyun());
            default -> System.out.println("您的选择有误");
        }


    }

    // 补全代码^[a-zA-Z]:\\(?:\w+\\?)*$
    public static void sendFile(Send send){
        String path = null;
        while (true) {
            System.out.println("请输入本地磁盘文件路径:");
            path = sc.nextLine();
            if (path.matches("^[a-zA-z]:.*")){
                break;
            }else{
                System.out.println("您输入的路径有误");
            }
        }
        Send.send(send,path);
    }


}
